package com.sanbuTech.foundation.service.impl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.sanbuTech.foundation.manager.ExceptionRecordManager;
import com.sanbuTech.foundation.model.ExceptionRecord;
import com.sanbuTech.foundation.service.IExceptionRecordService;

@Service("exceptionRecordService")
public class ExceptionRecordServiceImpl implements IExceptionRecordService {
	
	private static Logger logger = Logger.getLogger(ExceptionRecordServiceImpl.class);
	
	@Autowired
	private ExceptionRecordManager exRecordManager;

	
	/**
	 * 入库异常记录
	 * @param trace
	 * @param passport
	 * @return
	 */
	@Transactional(propagation=Propagation.SUPPORTS)
	public int createRecord(String trace, String restfulUrl, String passport){
		
		ExceptionRecord exRecord = new ExceptionRecord();
		exRecord.setTrace(trace);
		exRecord.setRestfulUrl(restfulUrl);
		exRecord.setPassport(passport);
		
		return exRecordManager.insertOne(exRecord);
	}
	
	
}
